package com.tyk.bookstore.back.task.schedule;

import com.tyk.bookstore.back.common.core.model.type.BaseEnum;

/**
 * @author tyk
 * @description TaskEnum
 */
public enum TaskEnum implements BaseEnum {

    BOOK_COLLECT_NUM(0, "Book:FlushCollectNum"),
    BOOK_PAY_NUM(1, "Book:FlushPayNum"),
    BOOK_SALE_NUM(2, "Book:FlushSaleNum"),
    BOOK_COMMENT_NUM(3, "Book:FlushCommentNum"),
    BOOK_LIKE_NUM(4, "Book:FlushLikeNum");


    private final Integer code;
    private final String name;

    TaskEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据name获取TaskEnum
     */
    public static TaskEnum of(String name) {
        for (TaskEnum task : TaskEnum.values()) {
            if (task.name.equals(name)) return task;
        }
        return null;
    }

    @Override
    public Integer value() {
        return this.code;
    }

}
